package org.third.spring.boot.hello.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.third.spring.boot.hello.domain.HelloUser;

import java.util.Collection;
import java.util.List;

@Repository
public interface HelloUserRepository extends CrudRepository<HelloUser, Long> {

	HelloUser findByUuid(String uuid);

	//
	HelloUser findByIdGreaterThan(Long id);

	HelloUser findByIdGreaterThanEqual(Long id);

	HelloUser findByUuidIn(Collection<String> userIdList);

	List<HelloUser> findByUuidNotIn(Collection<String> userIdList);

	@Query("select u from HelloUser u where u.name like %?1")
	List<HelloUser> findByFirstnameEndsWith(String firstname);

	@Query("select u from HelloUser u where u.uuid = ?1")
	HelloUser findByEmailAddress(String emailAddress);
}
